/**
 * @must 引入toolkitJq.js，请增加：id="toolkitJq"
 * @note 所有常用的方法，可以增加于此
 */
;(function (window, document, factory, $) {

    factory && factory(window, document, $);

})(window, document, function (window, document, $) {
    //页面没有jq，就引入
    // if(!$){
    //     if (!window.$ && !window.jQuery && typeof(window.$) !== 'function' && typeof(window.jQuery) !== 'function') {
    //         var head = document.getElementsByTagName('head')[0];
    //         var script = document.createElement('script');
    //         script.type = 'text/javascript';
    //         script.src = 'http://cdn.bootcss.com/jquery/3.1.0/jquery.js';
    //         head.insertBefore(script,head.childNodes[0]);
    //     }
    // }
    var $ = window.$ || window.jQuery;
    (function () {
        var linkSrc = getPath() + 'toolkitJq.css';
        var link = $('<link rel="stylesheet" href="' + linkSrc + '">');
        $('head').append(link);

        function getPath() {
            var a = document.scripts,
                b = a[a.length - 1],
                c = b.src;
            if (!b.getAttribute("merge")) {
                return c.substring(0, c.lastIndexOf("/") + 1)
            }
            ;
        }
    })();
    window.toolkit = {
        /////////////////////////////弹框，二选一，两个按钮--默认：确认&&取消 ...  /////////////////////////////////////
        // 使用方法：页面加载完后，调用toolkit.popupSelect.init(opt);
        // 参数opt：
        // opt = {
        //     'title':"aa",
        //     'content':"bb",
        //     'btn':[
        //         {
        //             'name':'btn1',
        //             'callback':function(){

        //             }
        //         },
        //         {
        //             'name':'btn2',
        //             'callback':function(){

        //             }
        //         }
        //     ]
        // };
        popupSelect: {
            init: function (opts,el) {
                this.opts = opts;
                this.el = el;
                this._optArgument();
                this._createEl();
                this.selectWindow = $('#selectWindow');
                this.title = $('.header span', this.selectWindow);
                this.textContent = $('.text', this.selectWindow);
                this.closeSelect = $('#closeSelect');
                this.btn1 = $('#selectFirst');
                this.btn2 = $('#selectSec');
                this._showText();
                this._clickClose();
                this._clickBtn();
            },
            _createEl: function () {
                var html = '<div id="selectWindow"><div class="select-content" style="width:' + this.opt.width + ';height:' + this.opt.height + '"><div class="header"><span></span><em id="closeSelect">×</em></div><p class="text">2222</p><p class="select-btns"><a id="selectFirst" href="javascript:void(0)"></a><a id="selectSec" href="javascript:void(0)"></a></p></div></div>';
                $('body').append(html);
            },
            _optArgument: function () {
                var opt = {
                    'title': "消息提示",
                    'content': "您确认执行该操作吗？",
                    'width': '300px',
                    'height': '180px',
                    'btn': [
                        {
                            'name': '确定'
                        },
                        {
                            'name': '取消'
                        }
                    ]
                };
                this.opt = jQuery.extend(true, opt, this.opts);
            },
            _showText: function () {
                this.title.text(this.opt.title);
                this.textContent.html(this.opt.content);
                this.btn1.text(this.opt.btn[0].name);
                this.btn2.text(this.opt.btn[1].name);
            },
            _clickClose: function () {
                var closeWindow = this.close;
                var close = (typeof this.opt.close == 'function') ? this.opt.close : this.close;
                var fun = this.opt.close;
                this.closeSelect.click(function () {
                    if (typeof fun == 'function') {
                        close();
                        closeWindow();
                    } else {
                        close();
                    }

                });
            },
            _clickBtn: function () {
                var btn1Callback = this.opt.btn[0].callback;
                var btn2Callback = this.opt.btn[1].callback;
                var param1 = this.el;
                console.log(btn1Callback);
                var closeWindow = this.close;
                var btn1Fun = (typeof btn1Callback == 'function') ? function () {

                    btn1Callback(param1);
                    closeWindow();
                } : closeWindow;
                var btn2Fun = (typeof btn2Callback == 'function') ? function () {
                    btn2Callback();
                    closeWindow();
                } : closeWindow;
                this.btn1.click(btn1Fun);
                this.btn2.click(btn2Fun);
            },
            close: function () {
                $('#selectWindow').fadeOut().remove();
            }
        },
        ///////////////////////////// body添加iframe标签，开始 /////////////////////////////////////
        // 参数 src,id 
        openIframe: function (src, id) {
            id = id || 'privateIframeWindow';
            var html = '<iframe id="' + id + '" class="showIframeStyle" src="' + src + '" frameborder="0"></iframe>';
            $('body').append(html).addClass('parentScroll');
        },
        closeIframe: function (id) { //该方法需要在子页面调用
            id = id ? '#' + id : "iframe";
            $("body", parent.document).removeClass('parentScroll');
            $(id, parent.document).remove();
        },
        ///////////////////////////// 搜索，开始 /////////////////////////////////////
        // 参数 input的id，匹配内容div的id，搜索按钮id，返回匹配内容的function，搜索的function
        autoSearch: {
            init: function (obj, autoObj, search, arrFun, callback) {
                this.obj = $('#' + obj); //输入框
                this.autoObj = $('#' + autoObj); //DIV的根节点
                this.search = $('#' + search);  //搜索按钮
                // this.value_arr=arrFun();        //不要包含重复值
                this.arrFun = arrFun;   // 获取匹配内容的func
                this.callback = callback; //开始搜索的function
                this.index = -1;          //当前选中的DIV的索引
                this.search_value = "";   //保存当前搜索的字符
                this._hideAutoObj();
                this._keyUp();
                this._clickSearchBtn();
            },
            _hideAutoObj: function () {
                this.autoObj.addClass('auto_hidden');
            },
            _clickSearchBtn: function () {
                var _this = this;
                this.search.click(function () {
                    _this.callback();
                    _this.autoObj[0].className = "auto_hidden";
                });
            },
            _positionAutoObj: function (_this) {
                var borderWidth = parseInt(_this.obj.css("border-top-width"));
                _this.autoObj.css({
                    left: _this.obj.offset().left + "px",
                    top: _this.obj.offset().top + _this.obj.height() + 2 * borderWidth + "px",
                    width: _this.obj.width() + 2 * (borderWidth - 1) + "px"  // 1为_this.autoObj的borderWidth
                });
            },
            //删除自动完成需要的所有DIV
            _deleteDIV: function (_this) {
                while (_this.autoObj[0].hasChildNodes()) {
                    _this.autoObj[0].removeChild(_this.autoObj[0].firstChild);
                }
                _this.autoObj.className = "auto_hidden";
            },
            //设置值
            _setValue: function (_this) {
                return function () {
                    _this.obj.val(this.seq);
                    _this.autoObj[0].className = "auto_hidden";
                }
            },
            //模拟鼠标移动至DIV时，DIV高亮
            _autoOnmouseover: function (_this, _div_index) {
                return function () {
                    _this.index = _div_index;
                    var length = _this.autoObj[0].children.length;
                    for (var j = 0; j < length; j++) {
                        if (j != _this.index) {
                            _this.autoObj[0].childNodes[j].className = 'auto_onmouseout';
                        } else {
                            _this.autoObj[0].childNodes[j].className = 'auto_onmouseover';
                        }
                    }
                }
            },

            //更改classname
            _changeClassname: function (length, _this) {
                for (var i = 0; i < length; i++) {
                    if (i != _this.index) {
                        _this.autoObj[0].childNodes[i].className = 'auto_onmouseout';
                    } else {
                        _this.autoObj[0].childNodes[i].className = 'auto_onmouseover';
                        _this.obj.value = _this.autoObj[0].childNodes[i].seq;
                    }
                }
            },

            //响应键盘
            _pressKey: function (event, _this) {
                var length = _this.autoObj[0].children.length;
                //光标键"↓"
                if (event.keyCode == 40) {

                    ++_this.index;

                    _this.obj.val(_this.value_arr[_this.index]);
                    if (_this.index > length) {
                        _this.index = 0;
                        _this.obj.val(_this.value_arr[_this.index]);
                    } else if (_this.index == length) {
                        _this.obj.val(_this.search_value);
                    }
                    _this._changeClassname(length, _this);
                }

                //光标键"↑"
                else if (event.keyCode == 38) {
                    _this.index--;
                    _this.obj.val(_this.value_arr[_this.index]);
                    if (_this.index < -1) {
                        _this.index = length - 1;
                        _this.obj.val(_this.value_arr[_this.index]);
                    } else if (_this.index == -1) {
                        _this.obj.val(_this.search_value);
                    }
                    _this._changeClassname(length, _this);
                }

                //回车键

                else if (event.keyCode == 13) {
                    _this.autoObj[0].className = "auto_hidden";

                    _this.index = -1;
                    _this.callback();

                } else {

                    _this.index = -1;

                }

            },
            // input，keyup的时候调用_start
            _keyUp: function () {
                var _this = this;
                this.obj.keyup(function (event) {
                    _this.value_arr = _this.arrFun();  // input输入时，返回匹配值，不要包含重复值
                    _this._start(event, _this);
                });
                $('body').click(function (e) {
                    var _con = _this.obj; // 设置目标区域
                    if (!_con.is(e.target) && _con.has(e.target).length === 0) {
                        _this.autoObj[0].className = "auto_hidden";
                    }
                });
            },

            //程序入口

            _start: function (event, _this) {
                if (event.keyCode != 13 && event.keyCode != 38 && event.keyCode != 40) {

                    _this._positionAutoObj(_this);

                    _this._deleteDIV(_this);

                    _this.search_value = _this.obj.val();

                    var valueArr = _this.value_arr;

                    valueArr.sort();

                    if (_this.obj.val().replace(/(^\s*)|(\s*$)/g, '') == "") {
                        return;
                    }//值为空，退出

                    try {
                        var reg = new RegExp("(" + _this.obj.val() + ")", "i");
                    }// 匹配为true的加粗

                    catch (e) {
                        return;
                    }

                    var div_index = 0;//记录创建的DIV的索引

                    for (var i = 0; i < valueArr.length; i++) {
                        // valueArr[i].indexOf(this.obj.value);

                        // if(reg.test(valueArr[i])){

                        var div = document.createElement("div");

                        div.className = "auto_onmouseout";

                        div.seq = valueArr[i];

                        div.onclick = _this._setValue(_this);

                        div.onmouseover = _this._autoOnmouseover(_this, div_index);

                        div.innerHTML = valueArr[i].replace(reg, "<strong>$1</strong>");//搜索到的字符粗体显示

                        _this.autoObj[0].appendChild(div);

                        _this.autoObj[0].className = "auto_show";

                        div_index++;

                        // }

                    }
                }
                var children = _this.autoObj[0].children;
                var childrenNum = children.length;
                var pressKeys = _this._pressKey;

                // 下拉click
                for (var i = 0; i < childrenNum; i++) {
                    var childrenArr = children.innerText;
                    if (children[i].addEventListener) {

                        children[i].addEventListener('click', function () {
                            _this.callback();
                        });
                    } else {
                        children[i].attachEvent('onclick', function () {
                            _this.callback();
                        });
                    }
                }

                _this._pressKey(event, _this);
            }
        },
        // 参数 提示信息,黑框消失的时间
        hitMsg: {
            initMsg: function (msg, time) {
                this.msg = msg;
                this.time = time || 1500;
                this._createEl();
                this.hintMsg = $('#blackHitMsgW');
                this._addMsg();
                this._hideAfterTime();
            },
            _createEl: function () {
                var hintMsgLen = $('#blackHitMsgW').length;
                if (!hintMsgLen) {
                    var html = '<div id="blackHitMsgW"></div>';
                    $('body').append(html);
                } else {
                    $('#blackHitMsgW').fadeIn();
                }
            },
            _addMsg: function () {
                this.hintMsg.text(this.msg);
            },
            _hideAfterTime: function () {
                setTimeout(this._hideHintMsg, this.time);
            },
            _hideHintMsg: function () {
                $('#blackHitMsgW').fadeOut();
            }
        },
        /////////////////////////////关于数组操作js开始/////////////////////////////////////
        ///////////////////////////////常见的正则判断js开始///////////////////////////////////////////////
        //使用方法：regRule['email'].test(val) 返回true或false
        regRule: {
            email: function (email) {
                var reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
                //var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/ ;
                return reg.test(email);
            },
            userName: function (str) {
                var reg = /^[a-z0-9_-]{3,16}$/; //用户名
                return reg.test(str);
            },
            chineseName: function (str) {
                var reg = /^[\u4E00-\u9FA5]{2,4}$/;  //中文姓名
                return reg.test(str);
            },
            mobile: function (str) {
                var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/; //手机
                return reg.test(str);
            },
            tel: function (str) {
                var reg = /^0[\d]{2,3}-[\d]{7,8}$/; //固话
                return reg.test(str);
            },
            idCard: function (str) {
                var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //身份证
                return reg.test(str);
            },
            amount: function (str) {
                var reg = /^([1-9][\d]{0,10}|0)(\.[\d]{1,2})?$/;  //金额(10位整数2位小数)
                return reg.test(str);
            },
            positiveInt: function (str) {
                var reg = /^[1-9]*[1-9][0-9]*$/; //正整数
                return reg.test(str);
            },
           nonnegativeInt: function(str){
                var reg = /^\d+$/;
                return reg.test(str);
           },
            int: function (str) {
                var reg = /^-?\d+$/;//整数(不限位数)
                return reg.test(str);
            },
            bankCard: function (str) {
                //var reg = /^\d{16}|\d{19}$/; //16位或19位银行卡或信用卡号(先把空格replace为空串)
                var reg = /^-?\d+$/;
                return reg.test(str);
            }
        }
        ///////////////////////////////常见的正则判断js结束///////////////////////////////////////////////
    }
});
/**
 * 表单自动填充
 * @param data json 数据
 */
$.fn.populateForm = function (data) {
    return this.each(function () {
        var formElem, name;
        if (data == null) {
            this.reset();
            return;
        }
        for (var i = 0; i < this.length; i++) {
            formElem = this.elements[i];
            //checkbox的name可能是name[]数组形式
            name = (formElem.type == "checkbox") ? formElem.name.replace(/(.+)\[\]$/, "$1") : formElem.name;
            if (data[name] == undefined) continue;
            switch (formElem.type) {
                case "checkbox":
                    if (data[name] == "") {
                        formElem.checked = false;
                    } else {
                        //数组查找元素
                        if (data[name].indexOf(formElem.value) > -1) {
                            formElem.checked = true;
                        } else {
                            formElem.checked = false;
                        }
                    }
                    break;
                case "radio":
                    if (data[name] == "") {
                        formElem.checked = false;
                    } else if (formElem.value == data[name]) {
                        formElem.checked = true;
                    }
                    break;
                case "button":
                    break;
                default:
                    formElem.value = data[name];
            }
        }
    });
};
/**
 * 序列化表单为json
 * @returns {{}}
 */
$(function () {
    $.fn.serializeJson = function () {
        var serializeObj = {};
        var array = this.serializeArray();
        var str = this.serialize();
        $(array).each(function () {
            if (serializeObj[this.name]) {
                if ($.isArray(serializeObj[this.name])) {
                    serializeObj[this.name].push(this.value);
                } else {
                    serializeObj[this.name] = [serializeObj[this.name], this.value];
                }
            } else {
                serializeObj[this.name] = this.value;
            }
        });
        return serializeObj;
    };
});


/**
 * 初始化三级联动，直接调用此方法即可
 * @param address 初始值
 * @param provinceId 省份所对应的inuput 的id
 * @param cityId  市区所对应的input的id
 * @param areaId  县城所对应的input 的 id
 */
function initProvinceCityAndArear(address, provinceId, cityId, areaId, url) {
    if (url == null || url == "undefined") {
        url = webContext + "/region/getListByParentId";
    }
    p10091009province = provinceId;
    c10091009city = cityId;
    a10091009area = areaId;
    width10091009 = address;
    url10091009 = url;
    bindProvince(address, provinceId, cityId, areaId, url);


}
var p10091009province = null;
var c10091009city = null;
var a10091009area = null;
var width10091009 = null;
var url10091009 = null;
//省市区的三级联动
//绑定省
function bindProvince(address, provinceId, cityId, areaId, url) {
    $.ajax({
        url: url,
        type: "POST",
        dataType: "json",
        success: function (data) {
            $("#" + provinceId).change(function () {
                $("#" + cityId).empty();
                $("#" + areaId).empty();
                bindCity(address, cityId, $("#" + provinceId).val(), areaId, url);
                bindD(address, areaId, -1, url);
            });
            // $("#" + provinceId).append("<option value='-1009'>---请选择省份--</option>");
            $.each(data, function (index, node) {
                if (address != null && address != "undefined" && typeof address != "undefined" && address.length > 1 && address.split("-")[0] == node.text) {
                    $("#" + provinceId).append("<option selected='selected' value='" + node.id + "'>" + node.text + "</option>");
                    bindCity(address, cityId, node.id, areaId, url);
                } else {
                    $("#" + provinceId).append("<option value='" + node.id + "'>" + node.text + "</option>");

                }
            })
            bindCity(address, cityId, -1, areaId, url);

        }

    });


}
//绑定市
function bindCity(address, cityId, parentId, areaId, url) {
    if (parentId == -1) {
        $("#" + cityId).append("<option value='-1009'>---请选择市(区)--</option>");
        bindD(address, areaId, -1, url);
        return;
    }
    $.ajax({
        url: url,
        type: "POST",
        data: {"parentId": parentId},
        dataType: "json",
        success: function (data) {
            $("#"+cityId).empty();
            $("#" + cityId).append("<option value='-1009'>---请选择市(区)--</option>");
            $.each(data, function (index, node) {

                if (address != null && address != "undefined" && typeof address != "undefined" && address.length > 1 && address.split("-")[1] == node.text) {
                    $("#" + cityId).append("<option selected='selected' value='" + node.id + "'>" + node.text + "</option>");
                    bindD(address, areaId, node.id, url);
                } else {
                    $("#" + cityId).append("<option value='" + node.id + "'>" + node.text + "</option>");
                }

            })
            $("#" + cityId).change(function () {
                $("#" + areaId).empty();
                bindD(address, areaId, $("#" + cityId).val(), url);
            })
        }
    });
}
//绑定区
function bindD(address, areaId, parentId, url) {

    if (parentId == -1) {
        $("#" + areaId).append("<option value='-1009'>---请选择县(区)--</option>");
        return;
    }
    $.ajax({
        url: url,
        type: "POST",
        data: {"parentId": parentId},
        dataType: "json",
        success: function (data) {
            $("#" + areaId).empty();
            $("#" + areaId).append("<option value='-1009'>---请选择县(区)--</option>");
            $.each(data, function (index, node) {
                if (address != null && address != "undefined" && typeof address != "undefined" && address.length > 2 && address.split("-")[2] == node.text) {
                    $("#" + areaId).append("<option selected='selected' value='" + node.id + "'>" + node.text + "</option>");
                } else {
                    $("#" + areaId).append("<option value='" + node.id + "'>" + node.text + "</option>");
                }
            })

        }
    });
}
/**
 * 获得是三级联动的返回值
 * {province: "山西-14", city: "大同-142", area: "阳高县-14221"}名称与id
 */
function getProvinceAndElseValue() {
    var province = {"province": $("#" + p10091009province).find("option:selected").text() + "-" + $("#" + p10091009province).val()};
    var city = {"city": $("#" + c10091009city).find("option:selected").text() + "-" + $("#" + c10091009city).val()};
    var area = {"area": $("#" + a10091009area).find("option:selected").text() + "-" + $("#" + a10091009area).val()};
    var address = new Object();
    var name = new Array();
    var ids = new Array();
    if ($("#"+p10091009province).val()!=-1009) {
        $.extend(true, address, province);
        name.push(province.province.split("-")[0]);
        ids.push(province.province.split("-")[1])
    }
    if ($("#"+c10091009city).val()!=-1009) {
        $.extend(true, address, city);
        name.push(city.city.split("-")[0])
        ids.push(city.city.split("-")[1])
    }
    if ($("#"+a10091009area).val()!=-1009) {
        $.extend(true, address, area);
        name.push(area.area.split("-")[0])
        ids.push(area.area.split("-")[1])
    }
    return {
        "address": address,
        "name": name.join("-"),
        "ids": ids.join("-")
    };
}
/**
 * 清空三级联动的值
 * @param width
 * @param provinceId
 * @param cityId
 * @param areaId
 * @param url
 */
function clearAddress() {
    bindProvince(width10091009, p10091009province, c10091009city, a10091009area, url10091009);
    bindCity(width10091009, c10091009city, -1, url10091009);
    bindD(width10091009, a10091009area, -1, url10091009);
    console.log(getProvinceAndElseValue());
}

    $(function(){
        //  placeholder();
        $("#evaluate").val($("#evaluate").attr("value"));
        $("#remitCheckSubmit").click(function(){
            var id = $("#id").val();
            var evaluate = $("#scoreNum").val();
            $.ajax({
                type : 'post',
                url : webContext+"/platform/personnel/saveBySupplier",
                dataType : "json",
                data : {
                    id :id,
                    evaluate:evaluate
                },
                success : function(data) {
                    if(data.success){
                        toolkit.hitMsg.initMsg("评级成功!");
                        $("#failWrapper").hide();
                        $('#scoreBystar .icon-star').addClass('gray');
                        window.location.reload();
                    }

                },
                error : function() {
                    showMessageDialog("请求出错,操作失败!",function () {
                        $("#failWrapper").hide();
                        $('#scoreBystar .icon-star').addClass('gray');

                    });
                }
            });


        })
    })
function seachCond(){
    $("#pageListForm").submit();
}

    function showRemit(id) {
        $.ajax({
            type : 'post',
            url : webContext+"/platform/personnel/findBySupplier",
            dataType : "json",
            data : {
                id :id,
            },
            success : function(data) {
                if (data.success == true) {
                    $('#id').val(data.data.id);
                    $('#scoreNum').val(data.data.evaluate);
                    $('#failWrapper').show();
                    initStar(data.data.evaluate);
                }
            },
            error : function() {
                showMessageDialog("请求出错,操作失败!",function () {
                    $('#evidenceMask').hide();
                });
            }
        });

    }
function initStar(lightNum){
    var $star = $('#scoreBystar .icon-star');
    for(var i=0;i<lightNum;i++){
        $star.eq(i).removeClass('gray');
    }
}
$(function(){
    $("#remitCancle").click(function(){
        $("#failWrapper").hide();
        $('#scoreBystar .icon-star').addClass('gray');
    })
    /* $("[name='company_gys']").each(function(){
     //评分星星
     scorefn($(this));
     });*/
    eachStar($('#scoreBystar .icon-star'));
});

// 遍历星星，触发点击事件
function eachStar(allStar){
    $.each(allStar,function(index,star){
        var $this = $(this);
        $this.click(function(){
            lightStar($this.parent(),index);
        });
    });
}

// 方案订单评分
function lightStar(starWrap,index){
    var $scoreText = $('span.score-text',starWrap);
    var $iconStar = $('span.icon-star',starWrap);


    // 得到具体评分数，赋给input
    var score = index + 1;
    $('input',starWrap).val(score);



    // 点亮星星，从左往右，从右往左
    if(!$iconStar.eq(index).hasClass('gray')){

        for(var i=index+1;i<5;i++){
            if (i!=0) {
                $iconStar.eq(i).addClass('gray');
            }
        }
    }else{
        for(var i=0;i<=index;i++){
            $iconStar.eq(i).removeClass('gray');
        }
    }
}
/**
 * 校验必填项是否符合要求,若不符合返回false,反之返回true
 */
function checkNumber(){
    var count = 0;
    var arr = $(".number");
    //校验必填项是否有值
    $.each(arr, function (index, node) {
        if (!toolkit.regRule.positiveInt($(node).val())) {
            toolkit.hitMsg.initMsg("数字输入不规范", 2000);
            $(node).focus();
        } else {
            count++;
        }
    });
    return count == arr.length ? true : false;
}
function checkValueIsNull() {
    var count = 0;
    var arr = $(".checkValueIsNull");
    //校验必填项是否有值
    $.each(arr, function (index, node) {
        if ($(node).val().trim() == "" || $(node).val() == "undefined") {
            toolkit.hitMsg.initMsg("请完善必填项信息", 2000);
            $(node).focus();
        } else {
            count++;
        }
    });
    return count == arr.length ? true : false;
}

function checkEmail() {
    var count = 0;
    var arr = $(".emailCheck");
    //校验邮箱是否输入正确
    $.each(arr, function (index, node) {
        if (!toolkit.regRule.email($(node).val())) {
            toolkit.hitMsg.initMsg("邮箱格式不正确", 2000);
            $(node).focus();
        } else {
            count++;
        }
    });
    return count == arr.length ? true : false;
}
function checkPhone() {
    var count = 0;
    var arr = $(".phoneCheck");
    //校验电话是否输入正确
    $.each(arr, function (index, node) {
        if (!toolkit.regRule.mobile($(node).val())) {
            if (!toolkit.regRule.tel($(node).val())) {
                toolkit.hitMsg.initMsg("电话号码输入格式不正确", 2000);
                $(node).focus();
            } else {
                count++;
            }
        } else {
            count++;
        }
    });
    return count == arr.length ? true : false;
}

